<?php
/**
 * 工厂类，大部分组件从这里生产
 * 实际上这个类包含两方面功能：
 * 1、工厂的工厂，用于生产各种业务的工厂，比如model、cache等，通过doom_config中的配置可改变工厂的工厂的产品
 * 2、具体业务的工厂，包含model、cache等工厂的方法
 */
class doom_core_factory {
    
    //引入lib
    //@TODO
    static private function importLib($libName) {
        
        require_once (DOOM_PROJECT_LIBOOT_DIR . $libName . '.liboot.php');
    }

    public static $_modelFactoryInstance;

    static public function getModel($type, $key, $extData = null) {
        if (!isset(self::$_modelFactoryInstance)) {
            $factoryClazz = doom_config::$FACTORY_MODEL_CLAZZ;
            self::$_modelFactoryInstance = new $factoryClazz();
        }
        return self::$_modelFactoryInstance->getModel($type, $key, $extData);
    }
    
    public static $_logFactoryInstance;
    
    static public function getLog($type, $extData = null) {
        if (!isset(self::$_logFactoryInstance)) {
            $factoryClazz = doom_config::$FACTORY_LOG_CLAZZ;
            self::$_logFactoryInstance = new $factoryClazz();
        }
        return self::$_logFactoryInstance->getLog($type, $extData);
    }

}
?>